import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

 
   
public class CII_CellRenderer extends JLabel implements ListCellRenderer {
    private static final Color HIGHLIGHT_COLOR = new Color(0, 0, 128);

    public CII_CellRenderer() {
        setOpaque(true);
        setIconTextGap(12);
    }

    public Component getListCellRendererComponent(
        JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus)
    {
        CII_Tree_Vectors entry = new CII_Tree_Vectors();
        if (value instanceof CII_Tree_Vectors) { 
        	entry = (CII_Tree_Vectors)value;
        setText(entry.toString());
        setFont(new java.awt.Font("Tahoma",0,11));
        if(isSelected) {
            setBackground(HIGHLIGHT_COLOR);
            setForeground(list.getBackground());
        } else {
            setBackground(list.getBackground());
            setForeground(list.getForeground());
        }
        if (entry.get(2).equals("CIIlib.TABLE_TYPE.COMP")) {
        	setFont(new java.awt.Font("Tahoma",1,11));
        }
//        if (entry.get(2).equals("CIIlib.TABLE_TYPE.COMP")) {
//        	setFont(new java.awt.Font("Tahoma",1,11));
//        }
        }
        return this;
    }
}
